<template>
  <div class="content">
    <div class="header">
      <h2><img :src="$serverUrl + user.icon" alt=""/></h2>
      <div class="user-box" style="display: flex;align-content: space-between;align-items: center; width: 2.25rem; margin-top:0.4125rem;margin-left:2.5rem;">
        <a href="javascript:;" style="text-align: center;">{{user.nikename}}</a>
        <a href="javascript:;" @click="logout" style="margin-left:0.3125rem; background:red; text-align: center;">退出</a>
      </div>
      <ul class="clear">
        <li>
          <span>0</span>
          <p>关注</p>
        </li>
        <li>
          <span>0</span>
          <p class="end">粉丝</p>
        </li>
      </ul>
    </div>
    <div class="docList">
      <ul>
        <li class="gk-text">
          <i></i>
          <p>公开博文</p>
          <b></b>
          <span>0</span>
        </li>
        <li class="mm-text">
          <i></i>
          <p>秘密博文</p>
          <b></b>
          <span>0</span>
        </li>
        <li class="cg-text">
          <i></i>
          <p>草稿箱</p>
          <b></b>
          <span>0</span>
        </li>
        <li class="sc-text">
          <i></i>
          <p>收藏夹</p>
          <b></b>
          <span>0</span>
        </li>
        <li class="my_cz">
          <i></i>
          <p>收藏夹</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
  export default {
    name:'user',
    props:{},
    data(){
      return {
        user:{}
      }
    },
    components:{},
    mounted(){
		
		this.$axios.get('/user').then(
			res=>{
				// console.log(res.data)
				this.user=res.data
				this.user.nikename = JSON.parse(window.localStorage.getItem('user')).name
				}
		)
	},
    updated(){},
    methods:{
		logout(){
			window.localStorage.removeItem('user');
			
			this.$router.push('/logon')
		}
	},
    computed: {
    }
  }
</script>

<style>
  @import url("../assets/css/mydoc.css");
</style>

